package entity;

/**
 * Created by yyh on 2019/1/27.
 */
public class Result {
    private boolean flag;//是否成功     

    public Result() {
    }

    public Result(boolean flag, Integer code, String message) {
        this.flag = flag;
        this.code = code;
        this.message = message;
    }

    public Result(boolean flag, Integer code, String message, Object data) {
        this.flag = flag;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Result ok(String message,Object data){
        return new Result(true,StatusCode.OK,message,data);
    }
    public static Result ok(String message){
        return ok(message,null);
    }
    public static Result ok(){
        return ok(null,null);
    }

    private Integer code;// 返回码     



    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setData(Object data) {
        this.data = data;
    }

    private String message;//返回信息     
    private Object data;// 返回数据

    public boolean isFlag() {
        return flag;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }


}
